/*
 * This file is part of QuickCPP.
 * (c) Copyright 2011 Jie Wang(twj31470952@gmail.com)
 *
 * QuickCPP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * QuickCPP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with QuickCPP.  If not, see <http://www.gnu.org/licenses/>.
 */
 
//==============================================================================
//
// $Revision: 2 $
// $Date: 2011-02-22 06:59:58 +0000 (Tue, 22 Feb 2011) $
//
//==============================================================================
//
// Class: FileDescriptor
// 
//==============================================================================

#ifndef QC_IO_FileDescriptor_h
#define QC_IO_FileDescriptor_h

#ifndef QC_IO_DEFS_h
#include "defs.h"
#endif //QC_IO_DEFS_h

#include "ResourceDescriptor.h"
//#include "FileSystem.h"

QC_IO_NAMESPACE_BEGIN

class InputStream;
class OutputStream;
class FileSystem;

class QC_IO_PKG FileDescriptor : public ResourceDescriptor
{
public:
	FileDescriptor(const FileSystem* pFS, bool bAutoClose);
	virtual ~FileDescriptor();

	virtual void close();
	AutoPtr<FileSystem> getFileSystem() const;

	static AutoPtr<FileDescriptor> In();
	static AutoPtr<FileDescriptor> Out();
	static AutoPtr<FileDescriptor> Err();

private: // not implemented
	FileDescriptor(const FileDescriptor& rhs);            // cannot be copied
	FileDescriptor& operator=(const FileDescriptor& rhs); // nor assigned

private:
	AutoPtr<FileSystem> m_rpFS;
};

QC_IO_NAMESPACE_END

#endif //QC_IO_FileDescriptor_h
